package com.weme.chat.viewmode

import com.osom.proto.message.NetworkOuterClass
import com.weme.common.base.BaseViewModel
import com.weme.common.manager.SocketManager
import com.weme.common.network.NetWorkUrl
import dev.kratos.api.user_server.v1.UserLoginRequest

class LoginViewMode : BaseViewModel() {


    fun fastLoginApi(req: UserLoginRequest) {
        val reqByte = req.toByteArray()
        sendNetworkRequest(reqByte, NetWorkUrl.Login)

    }

    fun fastGoogleLoginApi(req: UserLoginRequest) {
        val reqByte = req.toByteArray()
        sendNetworkRequest(reqByte, NetWorkUrl.GoogleLogin)



    }


    fun userLoginApi(req: NetworkOuterClass.LoginRequest) {
        try {
            SocketManager.send(req, NetworkOuterClass.NetworkCommand.CMD_GATEWAY_LOGIN_REQUEST.number, 0)
        } catch (e: Exception) { //log.error(e)
        }
    }

}